package com.agu.mgt.address.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.agu.utils.Query;

import java.util.List;
import java.util.Map;

import com.agu.mgt.address.dao.EntAddressDao;
import com.agu.entity.address.EntAddressEntity;
import com.agu.mgt.address.service.EntAddressService;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;


@Service("entAddressService")
@Transactional(readOnly = true)
public class EntAddressService{
	@Autowired
	private EntAddressDao entAddressDao;
	
	
	public EntAddressEntity queryObject(Long addressId){
		return entAddressDao.queryObject(addressId);
	}
	
	
	public List<EntAddressEntity> queryList(Map<String, Object> map){
		return entAddressDao.queryList(map);
	}
	
	public List<EntAddressEntity> querySelectList(Map<String, Object> map){
		return entAddressDao.querySelectList(map);
	}

    
	public Page<EntAddressEntity> queryPageList(Query query){
	    PageHelper.startPage(query.getPage(), query.getLimit());
	    return entAddressDao.queryPageList(query);
	}
	
	
	public int queryTotal(Map<String, Object> map){
		return entAddressDao.queryTotal(map);
	}
	
	
	@Transactional
	public void save(EntAddressEntity entAddress){
		entAddressDao.save(entAddress);
	}
	
	
	@Transactional
	public void update(EntAddressEntity entAddress){
		entAddressDao.update(entAddress);
	}
	
	
	@Transactional
	public void delete(Long addressId){
		entAddressDao.delete(addressId);
	}
	
	
	@Transactional
	public void deleteBatch(Long[] addressIds){
		entAddressDao.deleteBatch(addressIds);
	}
}
